package com.zj.common.mq;

//@Configuration
public class JmsConfigTest {
//	@Value("${mq.host}")
//	private String sqdbHost;
//	@Value("${mq.port}")
//	private Integer sqdbPort;
//	@Value("${mq.queue-manager}")
//	private String spdbQueueManager;
//	@Value("${mq.username}")
//	private String sqdbUsername;
//	@Value("${mq.password}")
//	private String spdbPassword;
//	@Value("${mq.receive-timeout}")
//	private long receiveTimeout;
//	
//	@Value("${mq.ybfschannel}")
//	private String ybfschannel;
//
//	@Value("${mq.ybjschannel}")
//	private String ybjschannel;
//
//	
//	@Value("${mq.ssfschannel}")
//	private String ssfschannel;
//
//	
//	@Value("${mq.ssjschannel}")
//	private String ssjschannel;
//
//	
//	
//
//	
//
//	@Bean(name = "ybfsConnectionFactory")
//	@Primary
//	public MQQueueConnectionFactory spdbConnectionFactory() {
//		MQQueueConnectionFactory mqQueueConnectionFactory = new MQQueueConnectionFactory();
//		mqQueueConnectionFactory.setHostName(sqdbHost);
//		try {
//			mqQueueConnectionFactory.setTransportType(WMQConstants.WMQ_CM_CLIENT);
//			mqQueueConnectionFactory.setCCSID(1381);
//			mqQueueConnectionFactory.setChannel(ybfschannel);
//			mqQueueConnectionFactory.setPort(sqdbPort);
//			mqQueueConnectionFactory.setQueueManager(spdbQueueManager);
//		} catch (Exception e) {
//			e.printStackTrace();
//		}
//		return mqQueueConnectionFactory;
//	}
//
//	@Bean(name = "ybfsUserCredentialsConnectionFactoryAdapter")
//	UserCredentialsConnectionFactoryAdapter spdbUserCredentialsConnectionFactoryAdapter(
//			@Qualifier(value = "ybfsConnectionFactory") MQQueueConnectionFactory mqQueueConnectionFactory) {
//		UserCredentialsConnectionFactoryAdapter userCredentialsConnectionFactoryAdapter = new UserCredentialsConnectionFactoryAdapter();
//		userCredentialsConnectionFactoryAdapter.setUsername(sqdbUsername);
//		userCredentialsConnectionFactoryAdapter.setPassword(spdbPassword);
//		userCredentialsConnectionFactoryAdapter.setTargetConnectionFactory(mqQueueConnectionFactory);
//		return userCredentialsConnectionFactoryAdapter;
//	}
//
//	@Bean(name = "ybfsCachingConnectionFactory")
//	public CachingConnectionFactory spdbCachingConnectionFactory(
//			@Qualifier(value = "ybfsUserCredentialsConnectionFactoryAdapter") UserCredentialsConnectionFactoryAdapter userCredentialsConnectionFactoryAdapter) {
//		CachingConnectionFactory cachingConnectionFactory = new CachingConnectionFactory();
//		cachingConnectionFactory.setTargetConnectionFactory(userCredentialsConnectionFactoryAdapter);
//		cachingConnectionFactory.setSessionCacheSize(500);
//		cachingConnectionFactory.setReconnectOnException(true);
//		return cachingConnectionFactory;
//	}
//
//	@Bean(name = "ybfsJmsTransactionManager")
//	public PlatformTransactionManager jmsTransactionManager(
//			@Qualifier(value = "ybfsCachingConnectionFactory") CachingConnectionFactory cachingConnectionFactory) {
//		JmsTransactionManager jmsTransactionManager = new JmsTransactionManager();
//		jmsTransactionManager.setConnectionFactory(cachingConnectionFactory);
//		return jmsTransactionManager;
//	}
//
//	@Bean(name = "ybfsJmsOperations")
//	public JmsOperations jmsOperations(
//			@Qualifier(value = "ybfsCachingConnectionFactory") CachingConnectionFactory cachingConnectionFactory) {
//		JmsTemplate jmsTemplate = new JmsTemplate(cachingConnectionFactory);
//		jmsTemplate.setReceiveTimeout(receiveTimeout);
//		return jmsTemplate;
//	}
//
//	
//	
//
//	
//	
//	@Bean(name = "ybjsConnectionFactory")
//	public MQQueueConnectionFactory ybjsConnectionFactory() {
//		MQQueueConnectionFactory mqQueueConnectionFactory = new MQQueueConnectionFactory();
//		mqQueueConnectionFactory.setHostName(sqdbHost);
//		try {
//			mqQueueConnectionFactory.setTransportType(WMQConstants.WMQ_CM_CLIENT);
//			mqQueueConnectionFactory.setCCSID(1208);
//			mqQueueConnectionFactory.setChannel(ybjschannel);
//			mqQueueConnectionFactory.setPort(sqdbPort);
//			mqQueueConnectionFactory.setQueueManager(spdbQueueManager);
//		} catch (Exception e) {
//			e.printStackTrace();
//		}
//		return mqQueueConnectionFactory;
//	}
//
//	@Bean(name = "ybjsUserCredentialsConnectionFactoryAdapter")
//	UserCredentialsConnectionFactoryAdapter ybjsUserCredentialsConnectionFactoryAdapter(
//			@Qualifier(value = "ybjsConnectionFactory") MQQueueConnectionFactory mqQueueConnectionFactory) {
//		UserCredentialsConnectionFactoryAdapter userCredentialsConnectionFactoryAdapter = new UserCredentialsConnectionFactoryAdapter();
//		userCredentialsConnectionFactoryAdapter.setUsername(sqdbUsername);
//		userCredentialsConnectionFactoryAdapter.setPassword(spdbPassword);
//		userCredentialsConnectionFactoryAdapter.setTargetConnectionFactory(mqQueueConnectionFactory);
//		return userCredentialsConnectionFactoryAdapter;
//	}
//
//	@Bean(name = "ybjsCachingConnectionFactory")
//	public CachingConnectionFactory ybjsConnectionFactoryCachingConnectionFactory(
//			@Qualifier(value = "ybjsUserCredentialsConnectionFactoryAdapter") UserCredentialsConnectionFactoryAdapter userCredentialsConnectionFactoryAdapter) {
//		CachingConnectionFactory cachingConnectionFactory = new CachingConnectionFactory();
//		cachingConnectionFactory.setTargetConnectionFactory(userCredentialsConnectionFactoryAdapter);
//		cachingConnectionFactory.setSessionCacheSize(500);
//		cachingConnectionFactory.setReconnectOnException(true);
//		return cachingConnectionFactory;
//	}
//
//	@Bean(name = "ybjsJmsTransactionManager")
//	public PlatformTransactionManager ybjsjmsTransactionManager(
//			@Qualifier(value = "ybjsCachingConnectionFactory") CachingConnectionFactory cachingConnectionFactory) {
//		JmsTransactionManager jmsTransactionManager = new JmsTransactionManager();
//		jmsTransactionManager.setConnectionFactory(cachingConnectionFactory);
//		return jmsTransactionManager;
//	}
//
//	@Bean(name = "ybjsJmsOperations")
//	public JmsOperations ybjsjmsOperations(
//			@Qualifier(value = "ybjsCachingConnectionFactory") CachingConnectionFactory cachingConnectionFactory) {
//		JmsTemplate jmsTemplate = new JmsTemplate(cachingConnectionFactory);
//		jmsTemplate.setReceiveTimeout(receiveTimeout);
//		return jmsTemplate;
//	}
//
//	
//	
//	
//	
//	
//	@Bean(name = "ssfsConnectionFactory")
//	public MQQueueConnectionFactory ssfsConnectionFactory() {
//		MQQueueConnectionFactory mqQueueConnectionFactory = new MQQueueConnectionFactory();
//		mqQueueConnectionFactory.setHostName(sqdbHost);
//		try {
//			mqQueueConnectionFactory.setTransportType(WMQConstants.WMQ_CM_CLIENT);
//			mqQueueConnectionFactory.setCCSID(1208);
//			mqQueueConnectionFactory.setChannel(ssfschannel);
//			mqQueueConnectionFactory.setPort(sqdbPort);
//			mqQueueConnectionFactory.setQueueManager(spdbQueueManager);
//		} catch (Exception e) {
//			e.printStackTrace();
//		}
//		return mqQueueConnectionFactory;
//	}
//
//	@Bean(name = "ssfsUserCredentialsConnectionFactoryAdapter")
//	UserCredentialsConnectionFactoryAdapter ssfsUserCredentialsConnectionFactoryAdapter(
//			@Qualifier(value = "ssfsConnectionFactory") MQQueueConnectionFactory mqQueueConnectionFactory) {
//		UserCredentialsConnectionFactoryAdapter userCredentialsConnectionFactoryAdapter = new UserCredentialsConnectionFactoryAdapter();
//		userCredentialsConnectionFactoryAdapter.setUsername(sqdbUsername);
//		userCredentialsConnectionFactoryAdapter.setPassword(spdbPassword);
//		userCredentialsConnectionFactoryAdapter.setTargetConnectionFactory(mqQueueConnectionFactory);
//		return userCredentialsConnectionFactoryAdapter;
//	}
//
//	@Bean(name = "ssfsCachingConnectionFactory")
//	public CachingConnectionFactory ssfsCachingConnectionFactory(
//			@Qualifier(value = "ssfsUserCredentialsConnectionFactoryAdapter") UserCredentialsConnectionFactoryAdapter userCredentialsConnectionFactoryAdapter) {
//		CachingConnectionFactory cachingConnectionFactory = new CachingConnectionFactory();
//		cachingConnectionFactory.setTargetConnectionFactory(userCredentialsConnectionFactoryAdapter);
//		cachingConnectionFactory.setSessionCacheSize(500);
//		cachingConnectionFactory.setReconnectOnException(true);
//		return cachingConnectionFactory;
//	}
//
//	@Bean(name = "ssfsJmsTransactionManager")
//	public PlatformTransactionManager ssfsjmsTransactionManager(
//			@Qualifier(value = "ssfsCachingConnectionFactory") CachingConnectionFactory cachingConnectionFactory) {
//		JmsTransactionManager jmsTransactionManager = new JmsTransactionManager();
//		jmsTransactionManager.setConnectionFactory(cachingConnectionFactory);
//		return jmsTransactionManager;
//	}
//
//	@Bean(name = "ssfsJmsOperations")
//	public JmsOperations ssfsjmsOperations(
//			@Qualifier(value = "ssfsCachingConnectionFactory") CachingConnectionFactory cachingConnectionFactory) {
//		JmsTemplate jmsTemplate = new JmsTemplate(cachingConnectionFactory);
//		jmsTemplate.setReceiveTimeout(receiveTimeout);
//		return jmsTemplate;
//	}
//
//	
//
//	
//	
//	
//	@Bean(name = "ssjsConnectionFactory")
//	public MQQueueConnectionFactory ssjsConnectionFactory() {
//		MQQueueConnectionFactory mqQueueConnectionFactory = new MQQueueConnectionFactory();
//		mqQueueConnectionFactory.setHostName(sqdbHost);
//		try {
//			mqQueueConnectionFactory.setTransportType(WMQConstants.WMQ_CM_CLIENT);
//			mqQueueConnectionFactory.setCCSID(1208);
//			mqQueueConnectionFactory.setChannel(ssjschannel);
//			mqQueueConnectionFactory.setPort(sqdbPort);
//			mqQueueConnectionFactory.setQueueManager(spdbQueueManager);
//		} catch (Exception e) {
//			e.printStackTrace();
//		}
//		return mqQueueConnectionFactory;
//	}
//
//	@Bean(name = "ssjsUserCredentialsConnectionFactoryAdapter")
//	UserCredentialsConnectionFactoryAdapter ssjsUserCredentialsConnectionFactoryAdapter(
//			@Qualifier(value = "ssjsConnectionFactory") MQQueueConnectionFactory mqQueueConnectionFactory) {
//		UserCredentialsConnectionFactoryAdapter userCredentialsConnectionFactoryAdapter = new UserCredentialsConnectionFactoryAdapter();
//		userCredentialsConnectionFactoryAdapter.setUsername(sqdbUsername);
//		userCredentialsConnectionFactoryAdapter.setPassword(spdbPassword);
//		userCredentialsConnectionFactoryAdapter.setTargetConnectionFactory(mqQueueConnectionFactory);
//		return userCredentialsConnectionFactoryAdapter;
//	}
//
//	@Bean(name = "ssjsCachingConnectionFactory")
//	public CachingConnectionFactory ssjsCachingConnectionFactory(
//			@Qualifier(value = "ssjsUserCredentialsConnectionFactoryAdapter") UserCredentialsConnectionFactoryAdapter userCredentialsConnectionFactoryAdapter) {
//		CachingConnectionFactory cachingConnectionFactory = new CachingConnectionFactory();
//		cachingConnectionFactory.setTargetConnectionFactory(userCredentialsConnectionFactoryAdapter);
//		cachingConnectionFactory.setSessionCacheSize(500);
//		cachingConnectionFactory.setReconnectOnException(true);
//		return cachingConnectionFactory;
//	}
//
//	@Bean(name = "ssjsJmsTransactionManager")
//	public PlatformTransactionManager ssjsjmsTransactionManager(
//			@Qualifier(value = "ssjsCachingConnectionFactory") CachingConnectionFactory cachingConnectionFactory) {
//		JmsTransactionManager jmsTransactionManager = new JmsTransactionManager();
//		jmsTransactionManager.setConnectionFactory(cachingConnectionFactory);
//		return jmsTransactionManager;
//	}
//
//	@Bean(name = "ssjsJmsOperations")
//	public JmsOperations ssjsjmsOperations(
//			@Qualifier(value = "ssjsCachingConnectionFactory") CachingConnectionFactory cachingConnectionFactory) {
//		JmsTemplate jmsTemplate = new JmsTemplate(cachingConnectionFactory);
//		jmsTemplate.setReceiveTimeout(receiveTimeout);
//		return jmsTemplate;
//	}
//
//	
//	//监听
//	
//	@Bean(name = "ssjsFactory")
//	public JmsListenerContainerFactory<?> ssjsFactory(
//			@Qualifier("ssjsCachingConnectionFactory") CachingConnectionFactory connectionFactory) {
//		DefaultJmsListenerContainerFactory factory = new DefaultJmsListenerContainerFactory();
//		factory.setConnectionFactory(connectionFactory);
//		return factory;
//	}
//	
//	@Bean(name = "ssfsFactory")
//	public JmsListenerContainerFactory<?> ssfsFactory(
//			@Qualifier("ssfsCachingConnectionFactory") CachingConnectionFactory connectionFactory) {
//		DefaultJmsListenerContainerFactory factory = new DefaultJmsListenerContainerFactory();
//		factory.setConnectionFactory(connectionFactory);
//		return factory;
//	}
//	
//	@Bean(name = "ybjsFactory")
//	public JmsListenerContainerFactory<?> ybjsspdbFactory(
//			@Qualifier("ybjsCachingConnectionFactory") CachingConnectionFactory connectionFactory) {
//		DefaultJmsListenerContainerFactory factory = new DefaultJmsListenerContainerFactory();
//		factory.setConnectionFactory(connectionFactory);
//		return factory;
//	}
//	
//	@Bean(name = "ybfsFactory")
//	public JmsListenerContainerFactory<?> spdbFactory(
//			@Qualifier("ybfsCachingConnectionFactory") CachingConnectionFactory connectionFactory) {
//		DefaultJmsListenerContainerFactory factory = new DefaultJmsListenerContainerFactory();
//		factory.setConnectionFactory(connectionFactory);
//		return factory;
//	}

}
